package me.softwareengineer.guice.rendering.domain;

import java.util.List;
import java.util.Map;

import me.softwareengineer.guice.rendering.listener.EndTableHeadCellEvent;
import me.softwareengineer.guice.rendering.listener.Listener;
import me.softwareengineer.guice.rendering.listener.StartTableHeadCellEvent;

/**
 * Represents a head of a row or column of a table.
 * 
 * @author yad.tahir
 * @see TableElement
 * @see TableCellElement <pre>
 * This class is thread-safe and can be cached/re-used and used concurrently.
 * </pre>
 */
public class TableHeadCellElement extends Element {

	/**
	 * Constructs a table header cell with the provided element properties
	 * 
	 * @param children
	 *            the sub elements of the head cell. Check {@link HasChildren}
	 *            for more details.
	 * @param properties
	 *            the properties of the element. For more info, please check
	 *            {@link HasProperties}
	 */
	public TableHeadCellElement(List<Element> children,
			Map<String, String> properties) {
		super(children, properties);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void afterElement(Listener l) {
		EndTableHeadCellEvent e = new EndTableHeadCellEvent(getAllProperties());
		l.onEvent(e);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void beforeElement(Listener l) {
		StartTableHeadCellEvent e = new StartTableHeadCellEvent(
				getAllProperties());
		l.onEvent(e);
	}
}
